#include "Form.hpp"
#include <iostream>

namespace Gui
{
    using namespace RevEng;
    
	Form::Form() : m_pForm (FormImpl::Create())
	{
		/*Bind properties*/
		Control::Position	= TProperty< ControlImpl, Vector2<int> >    (m_pForm , &ControlImpl::PropertySet_Position	, &ControlImpl::PropertyGet_Position);
		Control::Size		= TProperty< ControlImpl, Size2<int> >	    (m_pForm , &ControlImpl::PropertySet_Size		, &ControlImpl::PropertyGet_Size);
		Control::Visible	= TProperty< ControlImpl, bool >		    (m_pForm , &ControlImpl::PropertySet_Visible	, &ControlImpl::PropertyGet_Visible);
		Control::Text		= TProperty< ControlImpl, std::string >	    (m_pForm , &ControlImpl::PropertySet_Text		, &ControlImpl::PropertyGet_Text);

		/*Bind events*/
		Click = m_pForm->GetClickEvent();
		Close = m_pForm->GetCloseEvent();
		Resize = m_pForm->GetSizeEvent();
	}


	bool Form::DoEvents()
	{
		return m_pForm->DoEvents();
	}
	
	
	ControlImpl* Form::__GetImpl() const
	{
	    return m_pForm;
	}
}
